package org.xgj.jcs;

import org.apache.jcs.JCS;
import org.apache.jcs.access.exception.CacheException;

public class Test {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        try {
            JCS cache = JCS.getInstance("bookCache");
            //Put data into the cache location
            cache.put(1, "xgj1");
            cache.put(2, "xgj2");
            cache.put(3, "xgj3");
            cache.put(4, "xgj3");
            cache.put(5, "xgj3");
            cache.put(6, "xgj3");
            //Get data from the cache location
            String cacheData = (String) cache.get(1);
            System.out.println("Obtained from Cache :: " + cacheData);
            cacheData = (String) cache.get(2);
            System.out.println("Obtained from Cache :: " + cacheData);
            cacheData = (String) cache.get(3);
            System.out.println("Obtained from Cache :: " + cacheData);
        } catch (CacheException e) {
            e.printStackTrace();
        }
    }
}
